Urceni ciLocale stringu pro Locale identifier

Otázka od: Petr Fejfar

31. 10. 2002 18:00

Hi all,

nevi nekdo, jak prevest language ID na text, tedy jak zkonvertovat
napr. LANG_CZECH (0x05) na 'CS' resp. na 'Czech'?

Prolezal jsem SDK a na nic jsem neprisel.

Thx, pf


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.408 / Virus Database: 230 - Release Date: 24.10.2002

Odpovedá: Zbysek Hlinka

31. 10. 2002 20:08

On 31 Oct 2002 at 17:59, Petr Fejfar wrote:

> nevi nekdo, jak prevest language ID na text, tedy jak zkonvertovat
> napr. LANG_CZECH (0x05) na 'CS' resp. na 'Czech'?

Pohraj si s GetLocaleInfo.

S pozdravem

Zbysek Hlinka
E-mail: hlinka@hlinka.cz, localizator@localizator.com
Phone: +420 603 551 282

Odpovedá: Petr Fejfar

31. 10. 2002 21:20

From: "Zbysek Hlinka" <hlinka@hlinka.cz>

> Pohraj si s GetLocaleInfo.

Diky, to je ono. Pokud to zajima jeste nekoho, tak takhle se to da na
Gatesovi
loudit:

  function GetPieceOfLocaleInfo(aLCID,aLCType:integer): ANSIString;
  var
    Lng: integer;
  begin
    Result := sz;
    try
      Lng := GetLocaleInfo(aLCID,aLCType,nil,0);
      Win32Check(GetLastError=0);
      if Lng>1 then
        begin
          SetLength(Result,Lng-1);
          GetLocaleInfo(aLCID,aLCType,pChar(Result),Lng);
          Win32Check(GetLastError=0);
        end;
    except
      PxLOG.JCLCatch(PXLC_ERR);
      Result := sz;
    end;
  end;

a priklad, jak se to vola

var
  LanguageAbbr: ANSIString;
  CountryAbbr: ANSIString;
  CountryName: ANSIString;
  CountryNative: ANSIString;
begin
  CountryAbbr := GetPieceOfLocaleInfo
    (LOCALE_SYSTEM_DEFAULT,LOCALE_SABBREVCTRYNAME);
  LanguageAbbr := GetPieceOfLocaleInfo
    (LOCALE_SYSTEM_DEFAULT,LOCALE_SABBREVLANGNAME);
  CountryName := GetPieceOfLocaleInfo
    (LOCALE_SYSTEM_DEFAULT,LOCALE_SCOUNTRY);
  CountryNative := GetPieceOfLocaleInfo
    (LOCALE_SYSTEM_DEFAULT,LOCALE_SNATIVECTRYNAME);


Thx, pf



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.408 / Virus Database: 230 - Release Date: 24.10.2002

Odpovedá: Zbysek Hlinka

31. 10. 2002 21:12

On 31 Oct 2002 at 20:27, Petr Fejfar wrote:

> > Pohraj si s GetLocaleInfo.
>
> Diky, to je ono. Pokud to zajima jeste nekoho, tak takhle se to da na
> Gatesovi loudit:

No, to vis. Az nekdy budes psat lokalizacni tool, bude se ti to
hodit.  

S pozdravem

Zbysek Hlinka
E-mail: hlinka@hlinka.cz, localizator@localizator.com
Phone: +420 603 551 282